#!/bin/bash
echo "+--------------------------------------+"
echo "Network Addon Mod June 2009 Installer."
echo "Written for the NAM team by simmaster07"
echo "+--------------------------------------+"
sleep 2
clear

if [ ! -f ./NetworkAddonMod_Mac.zip ]
then
	echo "The Network Addon Mod ZIP archive was not found in the folder I'm in. Please move me or the zip file. Exiting..."
	sleep 5
	exit
fi

if [ ! -d "/Applications/SimCity 4" ] && [ ! -d "/Applications/SimCity 4 Deluxe" ]
then
	echo "The Network Addon Mod Installer has determined SimCity is not #installed on your machine (/Applications/SimCity 4 or /Applications/SimCity 4 Deluxe). If this is a fatal bug, please report it. Exiting..."
	sleep 7
	exit
fi

echo "Would you like to install the NAM for all users, in a custom directory, just you or another user?"
echo "1 - All users"
echo "2 - Custom directory"
echo "3 - Just you"
echo "4 - Another user"
read destination

while [ ! $destination = "1" ] && [ ! $destination = "2" ] && [ ! $destination = "3" ] && [ ! $destination = "4" ]; do
	echo "That was not an option. Please type 1 to install for all users, 2 for a custom folder, 3 for just you or 4 for another user."
	read destination
done

if [ $destination = "1" ]
then
	if [ -d "/Applications/SimCity 4 Deluxe" ]
	then
		export folder="/Applications/SimCity 4 Deluxe/Simcity 4 Data/Plugins"
	else
		export folder="/Applications/SimCity 4/Simcity 4 Data/Plugins"
	fi
	clear
elif [ $destination = "2" ]
then
	clear
	echo "Where would you like to install the NAM? (please type the full path)"
	read customdir
	while [ ! -d "$customdir" ]; do
		echo "That was an invalid path. Please type a valid path:"
		read customdir
	done
	export folder="$customdir"
	clear
elif [ $destination = "3" ]
then
	export folder="~"
	clear
elif [ $destination = "4" ]
then
	clear
	echo "Which user would you like to install the NAM for? (username only)"
	read userc
	while [ ! -d "/Users/$user" ]; do
		echo "That was not a valid user. (\"/Users/$user\" does not exist.) Please type the username again."
		read user
	done
	export folder="/Users/$user/Documents/SimCity 4/Plugins"
	clear
fi

echo "Installing to ${folder}..."

mkdir NAM_Temp &>> install.log
unzip -o -d NAM_Temp NetworkAddonMod_Mac.zip &>> install.log
cd NAM_Temp

echo "Creating NAM directory..."
mkdir "${folder}/NAM" &>> install.log
if [ ! -d "${folder}/NAM" ]; then
	echo "The NAM folder does not exist! Do you have the proper permissions to install the NAM there? Is this a bug? Exiting..."
	sleep 6
	exit
fi
echo "Moving core files..."
mv "NetworkAddonMod1.dat" "${folder}/NAM" &>> install.log
if [ ! -f "${folder}/NAM/NetworkAddonMod1.dat" ]; then
	echo "The NetworkAddonMod1.dat file isn't in the NAM folder. Do you have the proper permissions to install the NAM there? Is this a bug? Exiting..."
	sleep 6
	exit
fi
mv "NetworkAddonMod2.dat" "${folder}/NAM" &>> install.log
mv "NetworkAddonMod3.dat" "${folder}/NAM" &>> install.log
mv "NetworkAddonMod4.dat" "${folder}/NAM" &>> install.log
mv "NetworkAddonMod5.dat" "${folder}/NAM" &>> install.log
mv "NetworkAddonMod_IndividualNetworkRULs.dat" "${folder}/NAM" &>> install.log
mv "NetworkAddonMod_Props.dat" "${folder}/NAM" &>> install.log
mv "NetworkAddonMod_UI.dat" "${folder}/NAM" &>> install.log
mkdir "${folder}/NAM/Plugins" &>> install.log
if [ ! -d "${folder}/NAM/Plugins" ]; then
	echo "The NAM plugins folder doesn't exist and we just made it! Exiting..."
	sleep 4
	exit
fi
mkdir "${folder}/NAM/Locale Files" &>> install.log
if [ ! -d "${folder}/NAM/Locale Files" ]; then
	echo "The NAM locale files folder doesn't exist and we just made it! Exiting..."
	sleep 4
	exit
fi
mkdir "${folder}/NAM/Additional Bridges" &>> install.log
if [ ! -d "${folder}/NAM/Additional Bridges" ]; then
	echo "The NAM bridges folder doesn't exist and we just made it! Exiting..."
	sleep 4
	exit
fi
mkdir "${folder}/NAM/Documentation" &>> install.log
if [ ! -d "${folder}/NAM/Documentation" ]; then
	echo "The NAM documentation doesn't exist and we just made it! Exiting..."
	sleep 4
	exit
fi
mkdir "${folder}/NAM/Documentation/images" &>> install.log
if [ ! -d "${folder}/NAM/Documentation/images" ]; then
	echo "The NAM documentation images folder doesn't exist and we just made it! Exiting..."
	sleep 4
	exit
fi
cd Documentation/images &>> install.log
mv *.* "${folder}/NAM/Documentation/images" &>> install.log
cd ../ &>> install.log
rmdir images &>> install.log
mv *.* "${folder}/NAM/Documentation" &>> install.log
cd ../ &>> install.log
rmdir Documentation &>> install.log
mv "Locale Files/NetworkAddonMod_Locale_english.dat" "${folder}/NAM/Locale Files" &>> install.log
rmdir "Locale Files" &>> install.log
mv "Plugins/NetworkAddonMod_CanAM_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
echo "PLEASE NOTE -- Do NOT remove the NAM_Temp folder until the installer has finished running!"
clear &>> install.log

echo "+-------------+"
echo "NAM Essentials"
echo "+-------------+"
echo ""
echo "+++ NAM Right-Hand Drive"
echo "    Choose only if you have an RHD version of the game (i.e. USA)"
echo "    Press 1 to select this option, then press ENTER or RETURN"
echo "+++ NAM Left-Hand Drive"
echo "    Choose only if you have an LHD version of the game (i.e. UK, Japan)"
echo "    Press 2 to select this option, then press ENTER or RETURN"
read essentials

while [ ! "$essentials" = "1" ] && [ ! "$essentials" = "2" ]; do
	echo "Bad input. Press 1 for RHD NAM or 2 for LHD NAM"
	read essentials
done

if [ $essentials = 1 ]; then
	echo ""
	echo "Copying RHD NAM files..."
	mv "NetworkAddonMod_Controller_RIGHT_HAND_VERSION.dat" "${folder}/NAM" &>> install.log
elif [ $essentials = 2 ]; then
	echo "Copying LHD NAM files..."
	mkdir "${folder}/NAM/z_Left Hand Version Plugin" &>> install.log
	if [ ! -d "${folder}/NAM/z_Left Hand Version Plugin" ]; then
		echo "The LHD folder doesn't exist and we just made it! Exiting..."
		sleep 4
		exit
	fi
	cd "z_Left Hand Version Plugin" &>> install.log
	mv *.* "${folder}/NAM/z_Left Hand Version Plugin" &>> install.log
	cd ../ &>> install.log
	rmdir "z_Left Hand Version Plugin"
fi

cd Plugins
echo ""
echo ""
echo "Install Additional Bridges plugin? [Y,N - default Y]"
read bridges

if [ "$bridges" = "Y" ] || [ "$bridges" = "y" ] || [ ! "$bridges" = "N" ] && [ ! "$bridges" = "n" ]; then
	echo ""
	echo "Copying Additional Bridges plugin..."
	mv "NetworkAddonMod_Additional_Bridges_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log	
	mv "NetworkAddonMod_Bridges_Plugin_Controller.dat" "${folder}/NAM" &>> install.log
fi

echo "Install Diagonal Streets plugin? [Y,N - default Y]"
read diagonal

if [ "$diagonal" = "Y" ] || [ "$diagonal" = "y" ] || [ ! "$diagonal" = "N" ] && [ ! "$diagonal" = "n" ]; then
	echo ""
	echo "Copying Diagonal Streets plugin..."
	mv "NetworkAddonMod_Diagonal_Streets_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log	
fi

echo "Install Ground Light Rail plugin? [Y,N - default Y]"
read glr

if [ "$glr" = "Y" ] || [ "$glr" = "y" ] || [ ! "$glr" = "N" ] && [ ! "$glr" = "n" ]; then
	echo ""
	echo "Copying GLR plugin..."
	mv "NetworkAddonMod_GroundLightRail_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log	
fi

echo "Install Double Decker / Underground Rail plugin? [Y,N - default Y]"
echo "NOTE: Double Decker networks meaning, for example, elevated rail over road"
read ddur

if [ "$ddur" = "Y" ] || [ "$ddur" = "y" ] || [ ! "$ddur" = "N" ] && [ ! "$ddur" = "n" ]; then
	echo ""
	echo "Copying Double Decker / Underground Rail plugin..."
	mv "NetworkAddonMod_Light_URail_Puzzle_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Install Double-Height Elevated Rail plugin? [Y,N - default Y]"
read dhe

if [ "$dhe" = "Y" ] || [ "$dhe" = "y" ] || [ ! "$dhe" = "N" ] && [ ! "$dhe" = "n" ]; then
	echo ""
	echo "Copying Double-Height El-Rail plugin..."
	mv "NetworkAddonMod_High_ElRail_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Install Double-Height Monorail plugin? [Y,N - default Y]"
read dhm

if [ "$dhm" = "Y" ] || [ "$dhm" = "y" ] || [ ! "$dhm" = "N" ] && [ ! "$dhm" = "n" ]; then
	echo ""
	echo "Copying Double-Height El-Rail plugin..."
	mv "NetworkAddonMod_High_Monorail_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Install Tram-in-Road plugin? [Y,N - default Y]"
read glrr

if [ "$glrr" = "Y" ] || [ "$glrr" = "y" ] || [ ! "$glrr" = "N" ] && [ ! "$glrr" = "n" ]; then
	echo ""
	echo "Copying Tram-in-Road plugin..."
	mv "NetworkAddonMod_GroundLightRailxRoad_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Install Tram-in-Street plugin? [Y,N - default Y]"
read glrs

if [ "$glrs" = "Y" ] || [ "$glrs" = "y" ] || [ ! "$glrs" = "N" ] && [ ! "$glrs" = "n" ]; then
	echo ""
	echo "Copying Tram-in-Street plugin..."
	mv "NetworkAddonMod_GroundLightRailxStreet_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Install Flexible Underpasses plugin? [Y,N - default Y]"
read flups

if [ "$flups" = "Y" ] || [ "$flups" = "y" ] || [ ! "$flups" = "N" ] && [ ! "$flups" = "n" ]; then
	echo ""
	echo "Copying FLexible UnderPasseS (FLUPS)..."
	mv "NetworkAddonMod_FLUPS_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
	mv "NetworkAddonMod_FLUPS_Props.dat" "${folder}/NAM/Plugins" &>> install.log
fi

clear

echo "+----------------------+"
echo "Custom Menu Icon Plugins"
echo "+----------------------+"

echo "Customize the highway menu? [Y,N - default Y]"
read hm

if [ "$hm" = "Y" ] || [ "$hm" = "y" ] || [ ! "$hm" = "N" ] && [ ! "$hm" = "n" ]; then
	echo ""
	echo "Copying plugins..."
	mv "NetworkAddonMod_Custom_Highway_Menu_Plugin_Optional.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Customize the rail menu? [Y,N - default Y]"
read hm

if [ "$rm" = "Y" ] || [ "$rm" = "y" ] || [ ! "$rm" = "N" ] && [ ! "$rm" = "n" ]; then
	echo ""
	echo "Copying plugins..."
	mv "NetworkAddonMod_Custom_Rail_Menu_Plugin_Optional.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Customize the misc transport menu? [Y,N - default Y]"
read hm

if [ "$mm" = "Y" ] || [ "$mm" = "y" ] || [ ! "$mm" = "N" ] && [ ! "$mm" = "n" ]; then
	echo ""
	echo "Copying plugins..."
	mv "NetworkAddonMod_Custom_Misc_Transport_Menu_Plugin_Optional.dat" "${folder}/NAM/Plugins" &>> install.log
fi

clear

echo "+-----------------+"
echo "Rail Viaduct Style"
echo "+-----------------+"
echo ""
echo "+++ Press 1 to change the rail viaduct texture to a grey rock color, then press ENTER or RETURN."
echo "+++ Press 2 to change the rail viaduct texture to a brown brick color, then press ENTER or RETURN."
echo "+++ Press 3 to change the rail viaduct texture to a red brick color, then press ENTER or RETURN."
read viaduct

while [ ! "$viaduct" = "1" ] && [ ! "$viaduct" = "2" ] && [ ! "$viaduct" = "3" ]; do
	echo "Invalid input. Press 1 for grey rock viaducts, 2 for brown brick viaducts or 3 for red brick viaducts."
	read viaduct
done

if [ "$viaduct" = "2" ]; then
	mv "NetworkAddonMod_Rail_Viaduct_Style_Brown.dat" "${folder}/NAM/Plugins" &>> install.log
elif [ "$viaduct" = "3" ]; then
	mv "NetworkAddonMod_Rail_Viaduct_Style_Red.dat" "${folder}/NAM/Plugins" &>> install.log
fi

cd "../Rail Textures" &>> install.log
clear
echo "+------------+"
echo "Rail Textures"
echo "+------------+"
echo ""
echo "+++ Press 1 to install darker textures by the SFBT, then press ENTER or RETURN"
echo "+++ Press 2 to install alternative textures by dedgren, then press ENTER or RETURN"
echo "+++ Press 3 to use the Maxis default (not recommended), then press ENTER or RETURN"
read railtexture

if [ "$railtexture" = "1" ]; then
	mkdir "${folder}/NAM/Railway Addon Mod" &>> install.log
	if [ ! -d "${folder}/NAM/Railway Addon Mod" ]; then
		echo "The Railway Addon Mod folder doesn't exist and we just made it! Exiting..."
		sleep 4
		exit
	fi
	mv "SFBT_Rail Textures Mod_Darker Textures.dat" "${folder}/NAM/Railway Addon Mod" &>> install.log
elif [ "$railtexture" = "2" ]
	mkdir "${folder}/NAM/Railway Addon Mod" &>> install.log
	if [ ! -d "${folder}/NAM/Railway Addon Mod" ]; then
		clear
		upper "(Fatal)"
		echo "The Railway Addon Mod folder doesn't exist and we just made it! Exiting..."
		lower
		sleep 4
		exit
	fi
	mv "zzz_Dual_Rail_Texture_NAM_Upgrade.dat" "${folder}/NAM/Railway Addon Mod" &>> install.log
	mv "zzz_Dual_Rail_Texture_Maxis_Upgrade.dat" "${folder}/NAM/Railway Addon Mod" &>> install.log
	mv "zzz_Dual_Rail_Texture_STR_Upgrade.dat" "${folder}/NAM/Railway Addon Mod" &>> install.log
fi

cd "../Plugins" &>> install.log
clear

echo "+--------------------------+"
echo "One-Way Road Arrow Reduction"
echo "+--------------------------+"
echo ""
echo "Would you like to reduce one-way arrows? [Y,N - default Y]"
read owrar
if [ "$owrar" = "Y" ] || [ "$owrar" = "y" ] || [ ! "$owrar" = "N" ] && [ ! "$owrar" = "n" ]; then
	mv "NetworkAddonMod_OneWayRoad_Arrows_Reduction_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Would you like to reduce one-way arrows at roundabouts? [Y,N - default Y]"
read owrarr
if [ "$owrarr" = "Y" ] || [ "$owrarr" = "y" ] || [ ! "$owrarr" = "N" ] && [ ! "$owrarr" = "n" ]; then
	mv "NetworkAddonMod_OneWayRoad_Roundabout_Arrows_Reduction_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

clear
echo "+----------+"
echo "Roundabouts"
echo "+----------+"
echo ""
echo "Would you like to install road roundabouts? [Y,N - default Y]"
read roundroad

if [ "$roundroad" = "Y" ] || [ "$roundroad" = "y" ] || [ ! "$roundroad" = "N" ] && [ ! "$roundroad" = "n" ]; then
	mv "NetworkAddonMod_Roundabouts_Roads_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Would you like to install street roundabouts? [Y,N - default Y]"
read roundstreet

if [ "$roundstreet" = "Y" ] || [ "$roundstreet" = "y" ] || [ ! "$roundstreet" = "N" ] && [ ! "$roundstreet" = "n" ]; then
	mv "NetworkAddonMod_Roundabouts_Streets_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Would you like to install one-way road roundabouts? [Y,N - default Y]"
read roundoneway

if [ "$roundoneway" = "Y" ] || [ "$roundoneway" = "y" ] || [ ! "$roundoneway" = "N" ] && [ ! "$roundoneway" = "n" ]; then
	mv "NetworkAddonMod_Roundabouts_OneWayRoads_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Would you like to install avenue roundabouts and wide curves? [Y,N - default Y]"
read roundave

if [ "$roundave" = "Y" ] || [ "$roundave" = "y" ] || [ ! "$roundave" = "N" ] && [ ! "$roundave" = "n" ]; then
	mv "NetworkAddonMod_Roundabouts_Avenues_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
	mv "NetworkAddonMod_WideRadiusCurves_Avenues_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

clear
echo "+-----------------+"
echo "Wide Radius Curves"
echo "+-----------------+"
echo "Would you like to install wide curves for roads and streets? [Y,N - default Y]"
read rscurve

if [ "$roundave" = "Y" ] || [ "$roundave" = "y" ] || [ ! "$roundave" = "N" ] && [ ! "$roundave" = "n" ]; then
	mv "NetworkAddonMod_WideRadiusCurves_Roads_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
	mv "NetworkAddonMod_WideRadiusCurves_Streets_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Would you like to install wide curves for rails? [Y,N - default Y]"
read racurve

if [ "$roundave" = "Y" ] || [ "$roundave" = "y" ] || [ ! "$roundave" = "N" ] && [ ! "$roundave" = "n" ]; then
	mv "NetworkAddonMod_WideRadiusCurves_Rails_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

clear
echo "+------------+"
echo "Turning Lanes"
echo "+------------+"
echo "Would you like to install avenue turning lanes? [Y,N - default Y]"
read turnave

if [ "$turnave" = "Y" ] || [ "$turnave" = "y" ] || [ ! "$turnave" = "N" ] && [ ! "$turnave" = "n" ]; then
	mv "NetworkAddonMod_TurningLanes_Avenues_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

echo "Would you like to install road turning lanes? [Y,N - default Y]"
read turnroad

if [ "$turnroad" = "Y" ] || [ "$turnroad" = "y" ] || [ ! "$turnroad" = "N" ] && [ ! "$turnroad" = "n" ]; then
	mv "NetworkAddonMod_TurningLanes_Roads_Plugin.dat" "${folder}/NAM/Plugins" &>> install.log
fi

clear
echo "+--------------------+"
echo "Canal Addon Mod Style"
echo "+--------------------+"
echo ""
echo "+++ Press 1 to install SimGoober's Canals, then press ENTER or RETURN."
echo "+++ Press 2 to install Callagrafx' Canals, then press ENTER or RETURN."
read canam

while [ ! "$canam" = "1" ] && [ ! "$canam" = "2" ]; do
	echo "Bad input. Press 1 for SimGoober canals or 2 for Callagrafx canals."
	read canam
done

if [ "$canam" = "1" ]; then
	mv "NetworkAddonMod_CanAM_Props_SG.dat" "${folder}/NAM/Plugins" &>> install.log
elif [ "$canam" = "2" ]; then
	mv "NetworkAddonMod_CanAM_Props_CAL.dat" "${folder}/NAM/Plugins" &>> install.log
fi

clear
cd "../Automata Controller" &>> install.log
mkdir "${folder}/NAM/Automata Controller" &>> install.log
if [ ! -d "${folder}/NAM/Automata Controller" ]; then
	echo "The Automata Controller folder doesn't exist and we just made it! Exiting..."
	sleep 4
	exit
fi
echo "+------------------------+"
echo "Automata Controller Files"
echo "+------------------------+"
echo ""
echo "+++ Press 1 to install the standard controller, then press ENTER or RETURN."
echo "+++ Press 2 to install the standard 24th controller, then press ENTER or RETURN."
echo "+++ Press 3 to install the radical controller, then press ENTER or RETURN."
echo "+++ Press 4 to install the radical 24th controller, then press ENTER or RETURN."
read automata

while [ ! "$automata" = "1" ] && [ ! "$automata" = "2" ] && [ ! "$automata" = "3" ] && [ ! "$automata" = "4" ]; do
	echo "Bad input. Press 1 for the standard controller, 2 for standard 24, 3 for radical or 4 for radical 24."
	read automata
done

if [ "$automata" = "1" ]; then
	mv "NetworkAddonMod_Automata_Plugin_Standard.dat" "${folder}/NAM/Automata Controller" &>> install.log
elif [ "$automata" = "2" ]; then
	mv "NetworkAddonMod_Automata_Plugin_Automata24.dat" "${folder}/NAM/Automata Controller" &>> install.log
elif [ "$automata" = "3" ]; then
	mv "NetworkAddonMod_Automata_Plugin_Radical.dat" "${folder}/NAM/Automata Controller" &>> install.log
elif [ "$automata" = "4" ]; then
	mv "NetworkAddonMod_Automata_Plugin_Radical_Automata24.dat" "${folder}/NAM/Automata Controller" &>> install.log
fi

clear
cd "../Traffic Controller" &>> install.log
mkdir "${folder}/NAM/Traffic Controller" &>> install.log
if [ ! -d "${folder}/NAM/Traffic Controller" ]; then
	echo "The Traffic Controller folder doesn't exist and we just made it! Exiting..."
	sleep 4
	exit
fi
echo "+------------------+"
echo "Traffic Controllers"
echo "+------------------+"
echo ""
echo "+++ Press 1 to install a Simulator A variant, then press ENTER or RETURN."
echo "+++ Press 2 to install a Simulator B variant, then press ENTER or RETURN."
echo "+++ Press 3 to install a Simulator Z variant, then press ENTER or RETURN."
read traffic

while [ ! "$traffic" = "1" ] && [ ! "$traffic" = "2" ] && [ ! "$traffic" = "3" ]; do
	echo "Invalid input. Press 1 to install Sim A, 2 to install Sim B or 3 to install Sim Z."
	read traffic
done

if [ "$traffic" = "1" ]; then
	clear
	echo "+-----------+"
	echo "Simulator A"
	echo "+-----------+"
	echo ""
	echo "+++ Press 1 to install Simulator A Easy"
	echo "+++ Press 2 to install Simulator A Medium"
	echo "+++ Press 3 to install Simulator A Hard"
	echo "+++ Press 4 to install Simulator A Park&Ride Easy"
	echo "+++ Press 5 to install Simulator A Park&Ride Medium"
	echo "+++ Press 6 to install Simulator A Park&Ride Hard"
	read SimA

	while [ ! "$SimA" = "1" ] && [ ! "$SimA" = "2" ] && [ ! "$SimA" = "3" ] && [ ! "$SimA" = "4" ] && [ ! "$SimA" = "5" ] && [ ! "$SimA" = "6" ]; do
		echo "Invalid input. Please review your choices and try again."
		read SimA
	done

	if [ "$SimA" = "1" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_A_Easy.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimA" = "2" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_A_Medium.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimA" = "3" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_A_Hard.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimA" = "4" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_AP_Easy.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimA" = "5" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_AP_Medium.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimA" = "6" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_AP_Hard.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	fi
elif [ "$traffic" = "2" ]; then
	clear
	echo "+-----------+"
	echo "Simulator B"
	echo "+-----------+"
	echo ""
	echo "+++ Press 1 to install Simulator B Easy"
	echo "+++ Press 2 to install Simulator B Medium"
	echo "+++ Press 3 to install Simulator B Hard"
	echo "+++ Press 4 to install Simulator B Park&Ride Easy"
	echo "+++ Press 5 to install Simulator B Park&Ride Medium"
	echo "+++ Press 6 to install Simulator B Park&Ride Hard"
	read SimB

	while [ ! "$SimB" = "1" ] && [ ! "$SimB" = "2" ] && [ ! "$SimB" = "3" ] && [ ! "$SimB" = "4" ] && [ ! "$SimB" = "5" ] && [ ! "$SimB" = "6" ]; do
		echo "Invalid input. Please review your choices and try again."
		read SimB
	done

	if [ "$SimB" = "1" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_B_Easy.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimB" = "2" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_B_Medium.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimB" = "3" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_B_Hard.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimB" = "4" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_BP_Easy.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimB" = "5" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_BP_Medium.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimB" = "6" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_BP_Hard.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	fi
elif [ "$traffic" = "3" ]; then
	clear
	echo "+-----------+"
	echo "Simulator Z"
	echo "+-----------+"
	echo ""
	echo "+++ Press 1 to install Simulator Z Low"
	echo "+++ Press 2 to install Simulator Z Medium"
	echo "+++ Press 3 to install Simulator Z High"
	echo "+++ Press 4 to install Simulator Z Ultra"
	echo "+++ Press 5 to install Simulator Z Park&Ride Easy"
	echo "+++ Press 6 to install Simulator Z Park&Ride Medium"
	echo "+++ Press 7 to install Simulator Z Park&Ride High"
	echo "+++ Press 8 to install Simulator Z Park&Ride Ultra"
	read SimZ

	while [ ! "$SimZ" = "1" ] && [ ! "$SimZ" = "2" ] && [ ! "$SimZ" = "3" ] && [ ! "$SimZ" = "4" ] && [ ! "$SimZ" = "5" ] && [ ! "$SimZ" = "6" ] && [ ! "$SimZ" = "7" ] && [ ! "$SimZ" = "8" ]; do
		echo "Invalid input. Please review your choices and try again."
		read SimZ
	done

	if [ "$SimZ" = "1" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_Z_Low.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimZ" = "2" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_Z_Medium.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimZ" = "3" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_Z_High.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimZ" = "4" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_Z_Ultra.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimZ" = "5" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_ZP_Low.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimZ" = "6" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_ZP_Medium.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimZ" = "7" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_ZP_High.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	elif [ "$SimZ" = "8" ]; then
		mv "NetworkAddonMod_Traffic_Plugin_ZP_Ultra.dat" "${folder}/NAM/Traffic Controller" &>> install.log
	fi
fi

cd "../Data Views" &>> install.log
clear
echo "Would you like to install Zone Data View? [Y,N - Default Y]"
read zonedata

if [ "$zonedata" = "Y" ] || [ "$zonedata" = "y" ] || [ ! "$zonedata" = "N" ] && [ ! "$zonedata" = "n" ]; then
	mkdir "${folder}/NAM/Data Views" &>> install.log
	if [ ! -d "${folder}/NAM/Data Views" ]; then
		echo "The NAM Data Views folder doesn't exist and we just made it! Exiting..."
		sleep 4
		exit
	fi
	mv "NetworkAddonMod_Zone_Data_View.dat" "${folder}/NAM/Data Views" &>> install.log
	if [ "$traffic" = "1" ]; then
		if [ "$SimA" = "1" ] || [ "$SimA" = "4" ]; then
			mv "NetworkAddonMod_Volume_Data_View_AB_Easy.dat" "${folder}/NAM/Data Views" &>> install.log
		elif [ "$SimA" = "2" ] || [ "$SimA" = "5" ]; then
			mv "NetworkAddonMod_Volume_Data_View_AB_Medium.dat" "${folder}/NAM/Data Views" &>> install.log
		elif [ "$SimA" = "3" ] || [ "$SimA" = "6" ]; then
			mv "NetworkAddonMod_Volume_Data_View_AB_Hard.dat" "${folder}/NAM/Data Views" &>> install.log
		fi
	elif [ "$traffic" = "2" ]; then
		if [ "$SimB" = "1" ] || [ "$SimB" = "4" ]; then
			mv "NetworkAddonMod_Volume_Data_View_AB_Easy.dat" "${folder}/NAM/Data Views" &>> install.log
		elif [ "$SimB" = "2" ] || [ "$SimB" = "5" ]; then
			mv "NetworkAddonMod_Volume_Data_View_AB_Medium.dat" "${folder}/NAM/Data Views" &>> install.log
		elif [ "$SimA" = "B" ] || [ "$SimB" = "6" ]; then
			mv "NetworkAddonMod_Volume_Data_View_AB_Hard.dat" "${folder}/NAM/Data Views" &>> install.log
		fi
	elif [ "$traffic" = "3" ]; then
		if [ "$SimZ" = "1" ] || [ "$SimZ" = "5" ]; then
			mv "NetworkAddonMod_Volume_Data_View_Z_Low.dat" "${folder}/NAM/Data Views" &>> install.log
		elif [ "$SimZ" = "2" ] || [ "$SimZ" = "6" ]; then
			mv "NetworkAddonMod_Volume_Data_View_Z_Medium.dat" "${folder}/NAM/Data Views" &>> install.log
		elif [ "$SimZ" = "3" ] || [ "$SimZ" = "7" ]; then
			mv "NetworkAddonMod_Volume_Data_View_Z_High.dat" "${folder}/NAM/Data Views" &>> install.log
		elif [ "$SimZ" = "4" ] || [ "$SimZ" = "8" ]; then
			mv "NetworkAddonMod_Volume_Data_View_Z_Ultra.dat" "${folder}/NAM/Data Views" &>> install.log
		fi
	fi
fi

clear
echo "Saving Installation directory for uninstaller..."
echo "${folder}" > /usr/NAMDir-5cu24bN
clear
echo "+-----------------------+"
echo "+ INSTALLATION COMPLETE +"
echo "+-----------------------+"
echo "It is now safe to remove the NAM_Temp folder."
echo "Enjoy your NAM installation!"
echo "You can view the documentation in NAM / Documentation in your installation folder."
echo "Auto closing in 10 seconds"
sleep 10
exit
